<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<script type="text/javascript" >
	$(document).ready(function(){
		$("option[value=${status}]").attr("selected","selected");
	})
</script>
<script type="text/javascript">
	
	
	
	function remove(uid){
		if (confirm("请确定删除该账户吗?")) {
			<%-- <%=request.getContextPath()%>/teachers/delete?tid=${u.tid} --%>
			location.href="<%=request.getContextPath()%>/teachers/delete?tid="+uid;
		    //跳转代码
		    alert("已删除该账户");
		}else{
			 alert("删除该账户失败");
		}
	}
	</script>
<head>
<base href="<%=basePath%>">
	<c:if test="${ empty requestScope.list}">
	<%-- <c:redirect url="../user/finduserlist?pageNo=1&u_id=&u_name=&isValid=">z</c:redirect> --%>
	<c:redirect url="/teachers/list">z</c:redirect>
  </c:if>
    <meta charset="UTF-8">
    <title>管理中心</title>
    <link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/main.css" />
<script type="text/javascript" src="js/modernizr.min.js"></script>
</head>
<body>
  
<div class="topbar-wrap white">
    <!--<div class="topbar-inner clearfix">-->
        <div class="topbar-logo-wrap clearfix">
            <h1 class="topbar-logo none"><a href="index.html" class="navbar-brand">管理中心</a></h1>
        </div>
    </div>
</div>
<div class="container clearfix">
    <div class="sidebar-wrap">
        <div class="sidebar-title">
            <h1>菜单</h1>
        </div>
 		<%@ include file="center.jsp"%>
    </div>
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i><a href="index.html" color="#white">首页</a><span class="crumb-step">&gt;</span><span class="crumb-name">教师查询</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
                <form action="teachers/list" method="post">
                    <table class="search-tab">
                        <tr>
                            <th width="40">ID:</th>
                            <td>
                                <input class="common-text" placeholder="teID" name="teid" value="${teid}" id="" type="text">
                            </td>
			    			<th width="40">名称:</th>
                            <td>
                                <input class="common-text" placeholder="name" name="tname" value="${tname}" id="" type="text">
                            </td>
                             <th width="70">创建日期:</th>
                            <td>
                                <input class="common-text" placeholder="createdate" name="createdate" value="${createdate}" id="" type="text">
                            </td>
                            <th width="40">状态:</th>
                            <td><select class="" id="status" name="status" width="100">
									<option value="">-请选择-</option>
									<option value="1" <c:if test="${status==1}">selected="'selected"</c:if>>有效</option>
									<option value="0" <c:if test="${status==0}">selected="'selected"</c:if>>无效</option>
							</select></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a id="batchDel" href="javascript:void(0)"><i class="icon-font"></i>xxx</a>
                        <a id="updateOrd" href="javascript:void(0)"><i class="icon-font"></i>xxx</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th>编号</th>
                            <th>名称</th>
                            <th>邮箱</th>
                            <th>手机号码</th>
                            <th>班级</th>
                            <th>学科</th>
                            <th>创建时间</th>
                            <th>角色</th>
							<th>状态</th>
							<th>操作</th>
                        </tr>
                        <c:if test="${empty requestScope.list}">
							<c:out escapeXml="y" value="<tr><td colspan='5'><h1 style='color: red; text-align: center;'>没有该用户</h1></td></tr>"></c:out>
						</c:if>
                        <c:forEach var="u" items="${list}" >
                        <tr>
                            <td>${u.teid}</td> <!--标签ID-->
                            <td>${u.tname }
                            </td>
                            <td>${u.email }</td> 
                            <td>${u.tel}</td> 
                            <td>${u.classid }</td> 
                            <td>${u.subjectid }</td> 
                            <td><fmt:formatDate value="${u.createdate}" type="both" /></td>
                            <td><c:choose>
								<c:when test="${u.roleid==1}">校长</c:when>
								<c:when test="${u.roleid==2}">主任</c:when>
								<c:when test="${u.roleid==3}">老师</c:when>
								</c:choose></td>
                            <td><c:choose>
								<c:when test="${u.status==0}">无效</c:when>
								<c:when test="${u.status==1}">有效</c:when>
								</c:choose></td>
			    <td> <a id="updateOrd" href="<%=request.getContextPath()%>/teachers/doupdate?tid=${u.tid}">修改<i class="icon-font">
				</i></a> <a href="teachers/list" onclick="remove(${u.tid})">删除</a>	 	
								<%-- <c:choose>
							 	<c:when test="${u.isValid==0}">
							 	<a href="" onclick="remove(${u.userId})">解封用户</a>	
	 							</c:when>
								<c:when test="${u.isValid==1}">
								<a href="" onclick="update(${u.userId})">封停用户</a>	
								</c:when>
								</c:choose> --%>
			    </td> 
                        </tr>
                       </c:forEach>
                    </table>
                   
		    
		    
                </div>
            </form>
        </div>
    </div>
    <!--/main-->
</div>
</body>
</html>